# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day121_pyqt5_menubar
   Description :
   Author :       fuml
   date：          2019/9/20
-------------------------------------------------
   Change Activity:
                   2019/9/20:This program creates a menubar. The
menubar has one menu with an exit action.
-------------------------------------------------
"""

import  sys
from  PyQt5.QtWidgets import  QMainWindow,QApplication,QAction,qApp,QMenuBar
from PyQt5.QtGui import QIcon

class Example(QMainWindow):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        exitAction = QAction(QIcon('exit.png'),'&Exit',self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit Application')
        exitAction.triggered.connect(qApp.quit)
        #self.statusBar().showMessage('Ready')
        menubar= self.menuBar()

        filemenu = menubar.addMenu('&File')
        filemenu.addAction(exitAction)
        # set gemotry
        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('menubar')
        # self.setWindowIcon(QIcon('web.png'))
        self.show()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())